package com.bjxst;



import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.FileOutputStream;

/**先有输出的内容，才有文件输入
 * 所以先创建好DataOutputStream ,再创建DataInputStream*/
public class DataOutputStream02 {
    public static void main(String[] args) {
        DataOutputStream dos = null;
        try{
            //处理流，缓冲流，字节流
            dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("d:/aa")));
            dos.writeUTF("中华");
            dos.writeDouble(Math.random());
            dos.writeInt(12);
            dos.writeBoolean(true);
            dos.writeChar('v');
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try{
                if(dos != null){
                    dos.close();
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
